package view.drawing;

import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;

import loadsave.Memento;

/**
 * This is the simplest of SpriteSheet types. It basically represents
 * an encapsulated image. It is a single frame sprite sheet.
 * 
 * @author matt
 *
 */
public class SingleFrameSpriteSheet extends SpriteSheet {


	
	/**
	 * Create a default single frame sprite sheet
	 * from the provided path to an image.
	 * 
	 * @param filepath
	 */
	public SingleFrameSpriteSheet(String filepath) {
		super(filepath);
		init();
	}
	
	private void init() {
		// Set the size of a frame to the total size of the image
		Image img = this.getImage();
		if (img != null) {
			int w = img.getWidth(null);
			int h = img.getWidth(null);
			this.setFrameSize(w, h);
		}
	}
	
	
	public SingleFrameSpriteSheet(String filepath, Dimension size) {
		super(filepath);
		
		this.setFrameSize(size);
	}

	/**
	 * Overridden operation ignores the index
	 * and returns the image of size frame size
	 * that starts at point (0, 0) 
	 */
	@Override
	public Rectangle getFrameBounds(int index) {
		return (new Rectangle(0, 0, this.getFrameWidth(), this.getFrameHeight()));
	}

	@Override
	public Memento getMemento() {
		// TODO Auto-generated method stub
		return null;
	}

}
